<?php

Class Controller_Index Extends Controller_Base
{
	private function check_user()
	{
		if(session_is_registered("myusername")){
			if($_SESSION['myusername'] == 'suser')
			{
				header("location:/suser/menu");
				exit;
			} else {
				header("location:/suser/login");
				exit;
			}
		}else{
			header("location:/suser/login");
			exit;
		}
		
	}
	
    function index() {
		
		//Quem és
		$this->check_user();
		
        $this->registry['template']->set ('first_name', 'Roberto');
		$this->registry['template']->set ('imagem', 'main.jpg');
		$this->registry['template']->show('common/banner');
        $this->registry['template']->show('index');
		$this->registry['template']->show('common/footer');
    }
    
	function logout()
	{
		session_destroy();
		header("location:/");
	}

}

?>